package com.qf.service;

import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author fy
 * @version V1.0
 * @Project workspace
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/10 14:54
 */
@Service("service1")
public class UserServiceImpl implements UserService {

    //需要被注入的用户dao全局对象
    @Autowired
    private UserMapper userMapper;

//    public UserMapper getUserMapper() {
//        return userMapper;
//    }
//
//    //进行set注入
//    public void setUserMapper(UserMapper userMapper) {
//        this.userMapper = userMapper;
//    }

    public List<User> findAll() {
        //直接用注入的userMapper对象
        List<User> list = userMapper.findUserAll();
        return list;
    }
    @Transactional
    public void updateUser(User user) {
        userMapper.updateUser(user);
        int i=1/0;

    }
}
